package view.ext;

import javax.swing.table.DefaultTableModel;
import java.util.Vector;

public class StudentViewTableModel extends DefaultTableModel {

    static Vector<String> columns = new Vector<>();
    private static StudentViewTableModel mainViewTableModel = new StudentViewTableModel();

    static {
        columns.addElement("学号");
        columns.addElement("课程号");
        columns.addElement("分数");
        columns.addElement("等级");
        columns.addElement("学期");
    }

    private StudentViewTableModel() {
        super(null, columns);
    }

    //????
//    private static MainViewTableModel assembleModel(Vector<Vector<Object>> date){
//        mainViewTableModel.setDataVector(date,columns);
//        return mainViewTableModel;
//    }
    public static Vector<String> getColumns() {
        return columns;
    }

    //????
    public static StudentViewTableModel assembleModel(Vector<Vector<Object>> date) {
        mainViewTableModel.setDataVector(date, columns);
        return mainViewTableModel;
    }


    public static void updateModel(Vector<Vector<Object>> date) {
        mainViewTableModel.setDataVector(date, columns);
    }

    @Override
    public boolean isCellEditable(int row, int column) {
        return false;
    }
}
